package com.zly.entity.enums;

public enum Keyword {

    IS_DYNAMIC_JSON_NODE("is_dynamic_json_node"),

    SEGMENT("segment"),
    SEGMENT_TYPE("segment_type"),
    SEGMENT_CONTENT("segment_content"),

    BLOCK_CONTENT("block_content"),
    BLOCK_TYPE("block_type"),
    BLOCK_TYPE_ABBR_WHEN("when"),
    BLOCK_TYPE_ABBR_OTHERWISE("otherwise"),
    BLOCK_TYPE_ABBR_NORMAL("normal"),

    WHEN_BLOCK_COND_EXPR("conditional_expression"),

    PLACEHOLDER_PARAMETERS("placeholder_parameters"),
    PARAMETER_IS_FUNCTION_RESULT("is_function_result"),
    PARAMETER_NAME("name"),
    PARAMETER_VALUE("value"),
    PARAMETER_VALUE_FUNCTION_NAME("function_name"),
    PARAMETER_VALUE_FUNCTION_ARGS("function_args"),
    PARAMETER_VALUE_ARG_AS_ARRAY("arg_as_array"),
    ;

    private final String strValue;

    private Keyword(String strValue) {
        this.strValue = strValue;
    }

    //从字符串值转为枚举值
    public static Keyword from(String strValue) {
        for(Keyword keyword : values()) {
            if(keyword.strValue.equals(strValue)) {
                return keyword;
            }
        }
        return null;
    }

    public String getStrValue() {
        return strValue;
    }

}
